home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-11 / drivel.zip / DRIVELTR.ASM < prev    next >
Assembly Source File  |  1993-01-04  |  1KB  |  43 lines

  1.     TITLE   "Get Current Drive Letter"
  2.     PAGE    60,132
  3.  
  4. .MODEL LARGE
  5. .CODE
  6.  
  7. ;
  8. ;   compile:    masm /mx driveltr;
  9. ;
  10.  
  11. ;
  12. ;   Function:       DriveLtr()
  13. ;   Parameters:     None
  14. ;   Returns:        char - The current drive letter
  15. ;   Author:         Mike Taylor
  16. ;   Date:           16 December 1988
  17. ;
  18. ;   Description:    This function call DOS int 21h function 19h to find out the
  19. ;                     current drive letter.  Function 19h returns a drive code
  20. ;                     that has this pattern:  0 = A:, 1 = B:, etc.
  21. ;
  22. ;   Called By:      Microsoft C large memory model routine
  23.  
  24.             PUBLIC  _DriveLtr
  25. _DriveLtr   PROC
  26.  
  27.     push    bp              ; save the caller's base pointer register
  28.     mov     bp,sp           ; establish our stack frame by saving the current
  29.                             ;   stack pointer
  30.  
  31.     xor     ax,ax           ; clear the ax register
  32.     mov     ah,19h          ; set up the call to DOS's Get Current Disk function
  33.     int     21h             ;   ah = function 19h of interrupt 21h
  34.     mov     ah,0            ; clear out high byte of ax
  35.  
  36.     pop     bp              ; restore callers base pointer
  37.  
  38.     ret
  39.  
  40. _DriveLtr   ENDP
  41.  
  42.     END
  43.